#ifndef SCOPE_SNAP_H
#define SCOPE_SNAP_H

#include "scope_type.h"
#include "scope_hw.h"
#include "scope_helper.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    uint32_t offset;
    uint32_t length;
    scope_snap_data buffer[2 * HTTP_FS_IV_NUM];
} scope_snap_info;

extern scope_adc_data g_scope_dma_points[PINGPONG][SCOPE_ADC_BUFFER_POINTS];
extern uint32_t g_scope_dma_buffer_ctrl[SCOPE_ADC_SNAP_COUNT];
extern uint32_t g_scope_dma_buffer_psram[SCOPE_ADC_SNAP_COUNT];

void scope_snap_set_running(bool running);
uint32_t scope_snap_buffer_get_adc_avg(int ch, int samples);

void scope_snap_init(void);
void scope_hw_poll(void);

void scope_snap_buffer_start(void);
void scope_snap_buffer_read(scope_snap_info *info);
void scope_snap_buffer_scale(int offset, int step);

void scope_snap_psram_start(void);
void scope_snap_psram_read(scope_snap_info *info);
void scope_snap_psram_scale(int offset, int step);
void scope_snap_psram_move(int code);

void scope_snap_psram_stop(void);

void *scope_snap_buffer_get_dma_target(void);

#ifdef __cplusplus
}
#endif

#endif
